// Program for production distribution
#include<stdio.h>
#include<stdlib.h>         
#include<time.h>              
int main()
{
    // inv=inventory, obl= order backlog, cover, tmrbl and tai = used for time delay,sr=sales rate,asr=average sales rate ,dinv= desired inventory,por= production order release,rbl=required backlog dt and t =time,
 dff = delivery rate from factory
    float inv=400;  
    float obl=800,cover=4,st=2,tmrbl=4,tai=10,T=300,t=0,dt=0.05,tabl=4;
    float sr,asr,dinv,por,rbl,dff;
    float i;
    printf("Enter sales rate: ");
    scanf("%f",&sr);
    for(t=0;t<T;t=t+dt)
    {   
        asr=sr;
        asr=(1-(dt/st))*asr+(dt/st)*sr;          // calculation of average sales rate
        dinv=asr*cover;                               // calculation of cover
        por=asr+((dinv-inv)/tai); n              // calculation of por 
        rbl=por*tmrbl;                                  // calculation of rbl 
        dff=(obl-rbl)/tabl;                           // calculation of dff
        inv=inv+(dff-sr)*dt;                         // calculation of inv 
        obl=obl+(por-dff)*dt;                     // calculation of obl 
        printf("\n DINV:%f",dinv);             // printing the calculated values
        printf("\n POR:%f",por);                // printing the calculated values
        printf("\n RBL:%f",rbl);                  // printing the calculated values
        printf("\n DFF:%f",dff);                  // printing the calculated values
        printf("\n INV:%f",inv);                 // printing the calculated values
        printf("\n OBL:%f",obl);                // printing the calculated values
        
    }
          
       
      
    getchar();
    getchar();
}




__________________________________________________________________________________
  
INPUT FORMAT
 
Enter the sales rate : 20

__________________________________________________________________________________

OUTPUT FORMAT

it will calculate dinv,por,rbl,dff,inv,obl every when the loop will execute.
The number of loop will be executed (T/dt =300/0.05 = 6000) times.

__________________________________________________________________________________




